<!DOCTYPE html>
<html>
<head>
    <title>攻略系列</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/plugins/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/plugins/jquery/jquery.min.js"></script>
    <script src="/js/plugins/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/strategyCatalogs.css"/>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/common.js"></script>
    <script>
        var stitle;
        $(function () {
            //获取请求参数
            var params = getParams();

            //判断是否有传递strategyId
            if (params.strategyId) {
                //获取大攻略对象
                $.get('/strategies/' + params.strategyId, function (data) {
                    $(".title").html(data.title);
                    stitle = data.title
                });
                //获取攻略分类集合
                $.get('/strategies/' + params.strategyId + "/catalogs", function (data) {
                    var index = 1;
                    $(".catalogs").renderValues({list: data}, {
                        getName: function (item, value) {
                            $(item).html(index++ + "/" + value);
                        },
                        getHref: getHref
                    });
                });
                $("#reviewBtn").click(function () {
                    var url = "/strategyReview.html?strategyId=" + params.strategyId +"&stitle="+stitle;
                    location.href = url
                });
            }

            //获取攻略基本信息
            $.get('/strategies/'+params.strategyId, function (data) {
                //渲染到页面
                $(".strategies").renderValues(data);
            })
            $("#sousuo").click(function () {

            });


            $("#tiaozhuang").click(function () {
                var xo = $("#keyword").val();
                if (xo != ""){
                    $("#tiaozhuang").attr('href','allStrategy.html?text='+xo);
                }
            })



            //-------------------------------------------
            //获取大家都在看的游记
            $.get('/strategies/'+params.strategyId +'/travels', function (data) {
                //渲染到页面
                var index = 1;
                $(".hot").renderValues({list: data}, {
                    getName: function (item, value) {
                        $(item).html(index++ + "/" + value);
                    },
                    getHref: getHref
                });
            })
        });
    </script>
</head>

<body>
<div class="search-head">
    <div class="row nav-search">
        <div class="col-2">
            <a href="javascript:history.go(-1);">
                <span><i class="fa fa-chevron-left fa-2x"></i></span>
            </a>
        </div>
        <div class="col-20">

            <div class="input-group-sm ">
                <input type="text" placeholder="搜攻略" class="glyphicon-search" name="text" id="keyword">
                <a class="btn btn-default btn-sm" id="tiaozhuang">
                    <span class="glyphicon glyphicon-plus btn-sm" id="sousuo">搜索</span>
                </a>
            </div>

        </div>
    </div>
</div>

<div class="container strategies">
    <h5 class="title">广州攻略</h5>
    <small><span>0</span>人阅读过此攻略</small>
    <div class="focus">
        <i class="fa fa-heart"><span> 0</span> 收藏</i>
        <i class="fa fa-thumbs-up"><span> 0</span> 点赞</i>
        <button class="btn">想去</button>
        <button class="btn">去过</button>
    </div>
</div>
<ul class="nav nav-pills nav-justified border border-left-0 border-top-0 border-right-0" id="pills-tab">
    <li class="nav-item ">
        <a class="nav-link active" id="pills-catalog-tab" data-toggle="pill" href="#pills-catalog">
            <span>攻略目录</span>
        </a>
    </li>
    <!--<li class="nav-item">
        <a class="nav-link " id="pills-comment-tab" data-toggle="pill" href="#pills-comment">
            <span>骡友点评</span>
        </a>
    </li>-->
</ul>
<div class="tab-content " id="pills-tabContent">
    <div class="tab-pane fade show active" id="pills-catalog" >
        <div class="container hot">
            <h6>大家都在看</h6>
            <div render-loop="list">
                <a data-href="travelContent.html?id=" render-key="list.id" render-fun="getHref">
                    <button class="btn" render-html="list.title"></button>
                </a>
            </div>
        </div>

        <div class="catalogs">

            <div render-loop="list">
                <div class="container detail">
                    <h6 render-key="list.name" render-fun="getName"></h6>
                    <div render-loop="list.details">
                        <a data-href="strategyDetails.html?id=" render-key="list.details.id" render-fun="getHref">
                            <button class="btn" render-html="list.details.title"></button>
                        </a>
                    </div>
                </div>

            </div>
        </div>

    </div>
    <div class="tab-pane fade " id="pills-comment">

        <div class="container tag">
            <h6>骡友标签</h6>
            <div>
                <span>价格便宜</span>
                <span>很热闹</span>
                <span>交通方便</span>
                <span>吃的很多</span>
                <span>风景优美</span>
                <span>美食很多</span>
                <span>很特别</span>
                <span>爱上这座城</span>
                <span>住宿方便</span>
                <span>刚刚</span>
            </div>
        </div>
        <hr>

        <!--<div id="comment">
            <div>
                <div class="container row comment">
                    <div class="col-2 comment-head">
                        <a href="userProfiles.html">
                            <img class="rounded-circle"
                                 src="/upload/23a45130-e59c-4844-bc52-67aed3d57fc1.jpeg">
                        </a>
                    </div>
                    <div class="col comment-right">
                        <p class="authorName"><span>喵喵</span></p>
                        <span class="comment-star"><i
                                class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i
                                class="fa fa-star"></i><i class="fa fa-star-o"></i></span>
                        <span class="comment-date">2018-07-19</span>
                        <div class="comment-content">
                            <a href="strategyComment.html">
                                <p>我觉得很好</p>
                            </a>
                        </div>

                        <ul class="comment-img">
                            <li>
                                <img src="/upload/9d84bc42-2797-4cf7-a86f-bcf63e192c86.jpeg">
                            </li>
                        </ul>

                        <div class="d-flex icon">
                            <a href="strategyComment.html">
                                <i class="fa  fa-commenting-o " style="margin-right: 10px"> 评论 </i>
                                <i class="fa fa-thumbs-o-up"> <span>0</span> </i>
                            </a>
                        </div>

                    </div>
                </div>

            </div>
        </div>-->
    </div>

</div>
</div>

<div class="operation">
    <button class="btn">加入旅行单</button>
    <button class="btn" id="reviewBtn">骡友点评</button>
</div>


</body>
</html>